/*
 * @Author: xiaotiwen
 * @Date: 2020-06-01 15:47:49
 * @LastEditTime: 2020-07-01 17:04:08
 * @LastEditors: xiaotiwen
 * @FilePath: \eduweb\src\api\practiceManagement\practiceReworkManagement.js
 * @Description: 实践重修管理接口
 */

import fetch from 'common/src/utils/fetch';
import baseUrl from './env';
import UTILS from "common/src/utils/utils";

// 列表
export function getList(data) {
    return fetch({
        url: `${baseUrl}/udgPtPracticRetakeApplyInfoT/query`,
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        data
    });
}
// 删除
export function deletes(data) {
    return fetch({
        url: `${baseUrl}/udgPtPracticRetakeApplyInfoT/deleteById`,
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        data
    });
}
// 详情
export function getDetail(data) {
    return fetch({
        url: `${baseUrl}/udgPtPracticRetakeApplyInfoT/getDetail`,
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        data
    });
}

// 发布后进行排课修改
export function editPublishSchedule(data) {
  return fetch({
    url: `${baseUrl}/udgPtPracticRetakeApplyInfoT/editPublishSchedule`,
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data
  });
}

// 获取重修课程
export function getCourses(data) {
    return fetch({
        url: `${baseUrl}/udgPtPracticRetakeApplyInfoT/getCourses`,
        method: 'post',
        headers: {
            'Content-Type': 'application/json'
        },
        data
    });
}
// 重修排课
export function addPracticeRound(data) {
    return fetch({
        url: `${baseUrl}/udgPtPracticRetakeApplyInfoT/addPracticeRound`,
        method: 'post',
        headers: {
            'Content-Type': 'application/json'
        },
        data
    });
}
// 保存
export function saveData(data) {
    return fetch({
        url: `${baseUrl}/udgPtPracticRetakeApplyInfoT/add`,
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        data
    });
}
// 提交
export function submitData(data) {
    return fetch({
        url: `${baseUrl}/udgPtPracticRetakeApplyInfoT/submit`,
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        data
    });
}
//导出
export function exportData(data) {
    return fetch({
        url: `${baseUrl}/udgPtPracticRetakeApplyInfoT/exportTable`,
        method: "post",
        responseType: "blob",
        data
    }).then(res => {
        UTILS.downloadFile(
            res,
            "实践重修列表.xls",
            "application/vnd.ms-excel;charset=utf-8"
        );
    });
}

//排课导出
export function exportSchedule(data,name) {
    return fetch({
        url: `${baseUrl}/udgPtPracticRetakeApplyInfoT/exportSchedule?yearTerm=`+data.yearTerm
        +`&acdemyId=`+data.acdemyId,
        method: "GET",
        responseType: "blob"
    }).then(res => {
        UTILS.downloadFile(
            res,
            name,
            "application/vnd.ms-excel;charset=utf-8"
        );
    });
}

// 发布
export function publishSchedule(data) {
    return fetch({
        url: `${baseUrl}/udgPtPracticRetakeApplyInfoT/publishSchedule`,
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        data
    });
}

// 重修排课
export function insertDetail(data) {
    return fetch({
        url: `${baseUrl}/udgPtPracticRetakeApplyInfoT/insertDetails`,
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        data
    });
}
